package com.aps.demo.model;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import java.util.List;

/**
 * 人员数据模型
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "人员数据模型")
public class Personnel {
    
    @NotBlank(message = "人员ID不能为空")
    @JsonProperty("personnelId")
    @Schema(description = "人员ID", example = "EMP001")
    private String personnelId;
    
    @NotBlank(message = "姓名不能为空")
    @JsonProperty("name")
    @Schema(description = "姓名", example = "张三")
    private String name;
    
    @NotBlank(message = "工种不能为空")
    @JsonProperty("jobType")
    @Schema(description = "工种", example = "操作工")
    private String jobType;
    
    @NotBlank(message = "技能等级不能为空")
    @JsonProperty("skillLevel")
    @Schema(description = "技能等级", example = "中级")
    private String skillLevel;
    
    @NotNull(message = "日工时不能为空")
    @JsonProperty("dailyWorkHours")
    @Schema(description = "日工时")
    private TimeValue dailyWorkHours;
    
    @NotNull(message = "可操作设备不能为空")
    @JsonProperty("operableEquipment")
    @Schema(description = "可操作设备列表", example = "[\"EQ001\", \"EQ002\"]")
    private List<String> operableEquipment;
    
    @NotBlank(message = "人员状态不能为空")
    @JsonProperty("status")
    @Schema(description = "人员状态", example = "在岗")
    private String status;
    
    /**
     * 时间值模型
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Schema(description = "时间值模型")
    public static class TimeValue {
        @Positive(message = "时间值必须为正数")
        @JsonProperty("value")
        @Schema(description = "时间值", example = "8.0")
        private Double value;
        
        @NotBlank(message = "时间单位不能为空")
        @JsonProperty("unit")
        @Schema(description = "时间单位", example = "小时")
        private String unit;
    }
    
    /**
     * 技能等级枚举
     */
    @Schema(description = "技能等级枚举")
    public enum SkillLevel {
        SENIOR("高级"),
        INTERMEDIATE("中级"),
        JUNIOR("初级");
        
        private final String description;
        
        SkillLevel(String description) {
            this.description = description;
        }
        
        public String getDescription() {
            return description;
        }
    }
    
    /**
     * 人员状态枚举
     */
    @Schema(description = "人员状态枚举")
    public enum Status {
        ON_DUTY("在岗"),
        OFF_DUTY("离岗"),
        LEAVE("请假"),
        RESIGNED("离职");
        
        private final String description;
        
        Status(String description) {
            this.description = description;
        }
        
        public String getDescription() {
            return description;
        }
    }
} 